﻿@model PhoneBilling.Models.SourcePhnModel
@{
    ViewBag.Title = "原始话单查询";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript">       
$(document).ready(           
function () 
{  
    $(".myDatePickerClass1 ").datepicker({
        buttonImage: '@Url.Content("~/Content/image/calendar.gif")',               
        dateFormat: 'yy/mm/dd',                 
        showOn: 'button',               
        buttonImageOnly: true ,
        changeMonth:true,              
        changeYear:true,
    });   
    $(".myDatePickerClass2 ").datepicker({
        buttonImage: '@Url.Content("~/Content/image/calendar.gif")',               
        dateFormat: 'yy/mm/dd',                 
        showOn: 'button',               
        buttonImageOnly: true ,
        changeMonth:true,              
        changeYear:true,
    });

    change1();
    change2();
    change3();
}       
);

function changeAreaType() 
{
     var str = "";
     $(".areaType").each(function()
     {
        if($(this).attr("checked") == "checked")
        {
            str += $(this).attr("id");
        }
     });
     $("#areaType").val(str);
}

function change1() 
{
     $("#check1").attr("disabled" , $(".check1").attr("checked") != "checked");
}

function change2() 
{
     $("#check2").attr("disabled" , $(".check2").attr("checked") != "checked");
}

function change3() 
{
     $(".areaType").attr("disabled" , $(".check3").attr("checked") == "checked");
}

function exportClick() 
{
     changeAreaType();
     $(".export").val("True");
}

function searchClick() 
{
     changeAreaType();
     $(".export").val("False");
}

</script>
@using (Html.BeginForm())
{
    <div>
            @Html.HiddenFor(m => m.IsExport, new { @class ="export" })
        <h3 class="tlt">拨出信息</h3>
        <div class="input-text">
             @Html.LabelFor(m => m.主叫分机)
             @Html.TextBoxFor(m => m.主叫分机)
             @Html.LabelFor(m => m.拨出号码)
             @Html.TextBoxFor(m => m.拨出号码)
        </div>
        <div class="input-text">
             @Html.LabelFor(m => m.起始时间)
             @Html.TextBox("起始时间", Model.起始时间.ToString("d"), new { @class = "myDatePickerClass1" }) 
             @Html.TextBox("起始时间Time", Model.起始时间Time.ToString("HH:mm:ss")) 
             @Html.LabelFor(m => m.终止时间)
             @Html.TextBox("终止时间", Model.终止时间.ToString("d"), new { @class = "myDatePickerClass2" }) 
             @Html.TextBox("终止时间Time", Model.终止时间Time.ToString("HH:mm:ss")) 
        </div>
        <h3 class="tlt">花费金额</h3>
        <div class="input-text">
            @Html.CheckBoxFor(m => m.Is金额上, new { onclick = "change1()", @class = "check1" })
            @Html.LabelFor(m => m.金额上)
            @Html.TextBoxFor(m => m.金额上, new { id = "check1" })
            @Html.CheckBoxFor(m => m.Is金额下, new { onclick = "change2()", @class = "check2" })
            @Html.LabelFor(m => m.金额下)
            @Html.TextBoxFor(m => m.金额下, new { id = "check2" })
        </div>
        <h3 class="tlt">话类</h3>
        <div class="input-text">
             @Html.CheckBoxFor(m => m.所有话类, new { onclick = "change3()", @class = "check3" })
             @Html.LabelFor(m => m.所有话类)
             @Html.HiddenFor(m => m.话类, new { id = "areaType" })
    @{
        for (int i = 0;i <Model.话类List.Count;i++)
        {
            @Html.CheckBoxFor(m => m.话类List[i].IsSelected, new { onclick = "changeAreaType()", @class = "areaType", id = Model.话类List[i].ID })
            @Html.Label(string.Format(" {0} ", Model.话类List[i].Name))
        }
    }
        </div>
        <p class="submit">
            <div>
            <input type="submit" value="查询" class="input-submit" onclick="searchClick()" />
            <input type="submit" value="导出Excel" class="input-submit" onclick="exportClick()" />
            </div>
        </p>
    </div>
}

